import ddddocr


def image_ocr(path):
    try:
        ocr = ddddocr.DdddOcr()  # 创建ocr对象
        with open(path, 'rb') as f:  # 读取图片二进制字节
            img_bytes = f.read()
        res = ocr.classification(img_bytes)  # 识别图片
        return res[:4]  # 返回结果
    except Exception as e:
        # 异常处理
        return None
